<script setup lang="ts">
import { defineProps } from 'vue'

const props = defineProps({
  questionList: Array,
  isSolved: Array
})
</script>

<template>
  <div class="isSolveArea">
    <h3>答题情况</h3>
    <div class="questions">
      <div
        class="option"
        v-for="(item, index) in props.questionList"
        :key="item.id"
        :class="{ solved: props.isSolved[index] }"
      >
        {{ index + 1 }}
      </div>
    </div>
    <div class="btn-area">
      <slot name="save"></slot>
      <slot name="submit"></slot>
    </div>
  </div>
</template>

<style scoped>
.isSolveArea {
  position: absolute;
  right: 20px;
  top: 20px;
  width: 25%;
  padding: 20px;
  background-color: white;
  //box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

h3 {
  text-align: center;
}

.questions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: 20px;
  width: 80%;
  text-align: center;
}

.option {
  width: 20px;
  height: 20px;
  border: 1px solid black;
  margin: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.option.solved {
  background-color: green;
  color: white;
}

.btn-area {
  display: flex;
  width: 100%;
  justify-content: center;
  margin: 20px 0 20px 0;
  align-items: center;
}
</style>
